﻿namespace ReActiomTest2
{
    internal class Program
    {
        static void Main(string[] args)
        {
            double reactionTime = 0;
            Random random = new Random();
            int n = random.Next(7, 10);
            int i = 0;
            int countOfError = 0;
            DateTime startTime = DateTime.Now;

            for (i = 0; i <= n; i++)
            {
                Console.Clear();
                char character = (char)random.Next(65, 122);
                Console.WriteLine($"第{i}次测试,总耗时{reactionTime}秒,共错误{countOfError}次");
                Console.WriteLine(character);
                char direction = Console.ReadKey().KeyChar;

                if (direction == character)
                    Console.Clear();
                else
                {
                    Console.Clear();
                    countOfError++;
                }

                DateTime endTime = DateTime.Now;
                TimeSpan timeSpan =  endTime-startTime;
                reactionTime = timeSpan.TotalSeconds;
            
            }
            Console.WriteLine($"共{n}次测试,总耗时{reactionTime}秒,共错误{countOfError}次");
        }
    }
}